package com.mca.framework.stream;

import com.mca.framework.lambda.Student;

import java.util.ArrayList;
import java.util.List;

public class DemoAnyMatch {

    public static void main(String[] args) {
        List<Student> studentList = new ArrayList<>();
        studentList.add(new Student(1,"张三","M",19,true));
        studentList.add(new Student(2,"李四","M",18,false));
        studentList.add(new Student(3,"王五","F",21,true));
        studentList.add(new Student(4,"赵六","F",20,false));
        //any 任何一个
        boolean anyMatch = studentList.stream().anyMatch(s -> s.getAge() < 20);
        if(anyMatch){
            System.out.println("匹配studentList中的数据有任何一个小于20的就返回true");
        }
    }
}
